package class202204._21_25;
class Animal1 {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public Animal1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void eat(){
        System.out.println(this.name +"正在吃饭!");
    }
}
class Cat3 extends Animal1{
    public String hair;

    public Cat3(String name,int age,String hear){
        super(name,age);//显式调用父类的构造方法 来初始化 子类从父类继承过来的东西
        this.hair = hear;
    }


    public void mew() {
        //System.out.println(this.name+"正在叫！");//是不能访问了  不是没有继承
        System.out.println(this.getName()+"正在叫！");//是不能访问了  不是没有继承
    }
        }
public class demo2 {
    public static void main(String[] args) {
        Cat3 cat3 = new Cat3("mimi",8,"black");
        cat3.mew();
        cat3.eat();
    }
}
